import java.util.Scanner;
import java.util.Stack;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: LianBao
 * Date: 2024-05-05
 * Time: 12:52
 */
public class Test {
    public boolean isSubsequence(String S, String T) {
        // write code here
        int lenS = S.length();
        int lenT = T.length();
        int i = 0;
        int j = 0;
        while (i < lenS && j < lenT) {
            if (S.charAt(i) == T.charAt(j)) {
                i++;
                j++;
            } else {
                j++;
            }
        }
        return i == lenS;
    }

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        // 注意 hasNext 和 hasNextLine 的区别
        while (in.hasNextLine()) { // 注意 while 处理多个 case
            String s = in.nextLine();
            Stack<Character> stack = new Stack<>();
            for (int i = 0; i < s.length(); i++) {
                char ch = s.charAt(i);
                if (stack.isEmpty() || ch != stack.peek()) {
                    stack.push(ch);
                } else {
                    stack.pop();
                }
            }
            if (stack.isEmpty()) {
                System.out.println("0");
            } else {
                Stack<Character> stack2 = new Stack<>();
                while (!stack.isEmpty()) {
                    stack2.push(stack.pop());
                }
                while (!stack2.isEmpty()) {
                    System.out.print(stack2.pop());
                }
            }
        }
    }
}
